<?php
namespace addon\cms\controller;

use app\common\controller\AddonAdminBase;
use tpfcore\Core;
use tpfcore\helpers\Json;
use think\Request;
// +----------------------------------------------------------------------
// | Author: yaoyihong <510974211@qq.com>
// +----------------------------------------------------------------------
/**
 * ============================================================================
 * 版权所有 2017-2077 tpframe工作室，并保留所有权利。
 * @link http://www.tpframe.com/
 * @copyright Copyright (c) 2017 TPFrame Software LLC
 * ----------------------------------------------------------------------------
 * 这不是一个自由软件！未经本公司授权您只能在不用于商业目的的前提下对程序代码进行修改和使用；
 * 不允许对程序代码以任何形式任何目的的再发布。
 * ============================================================================
 */
class UserConsultManage extends AddonAdminBase
{
    public function index()
    {
        $this->addonTemplate("index",[
            "list"=>Core::loadAddonModel($this->name)->getUserConsulList($this->param),
            "fields"=>Core::loadAddonModel('CustomForm')->getCustomFieldsList(['form_id'=>$this->param['form_id']])
        ]);
    }

    public function edit()
    {
        IS_POST && $this->jump(Core::loadAddonModel($this->name)->saveCoUserData($this->post));

        $this->addonTemplate('form', [
            'vo'=>Core::loadAddonModel($this->name)->getCoUserInfo($this->param['uid']),
        ]);
    }

    public function sview()
    {
    	list($CustomForm, $Details) = Core::loadAddonModel($this->name)->getUserConsulDetails($this->param);
    	$this->addonTemplate('sview',[
            'vo' => $Details,
            'CustomForm' => $CustomForm
        ]);
    }

    public function export()
    {
    	Core::loadAddonModel($this->name)->exportUserConsul($this->param);
    }
} 
